// 渠道数据调试工具
import channelManager from './channelManager'

export const channelDebug = {
  // 打印当前状态
  logStatus() {
    const status = channelManager.getStatus()
    console.log('=== 渠道管理器状态 ===')
    console.log('渠道数量:', status.channelCount)
    console.log('监听者数量:', status.listenerCount)
    console.log('是否已初始化:', status.isInitialized)
    console.log('当前渠道数据:', channelManager.getChannels())
    console.log('渠道选项:', channelManager.getChannelOptions())
    console.log('========================')
  },

  // 强制刷新所有监听者
  refreshAllListeners() {
    console.log('强制刷新所有监听者...')
    channelManager.notifyListeners()
  },

  // 检查特定页面的渠道选项
  checkPageChannelOptions(pageName, channelOptions) {
    console.log(`=== ${pageName} 渠道选项检查 ===`)
    console.log('选项数量:', channelOptions.length)
    console.log('选项内容:', channelOptions)
    console.log('========================')
  },

  // 测试渠道数据获取
  testChannelData() {
    console.log('=== 渠道数据测试 ===')
    console.log('getChannels():', channelManager.getChannels())
    console.log('getChannelOptions():', channelManager.getChannelOptions())
    console.log('getChannelName(1):', channelManager.getChannelName(1))
    console.log('getChannelValue("官方渠道"):', channelManager.getChannelValue('官方渠道'))
    console.log('====================')
  }
}

// 在开发环境下自动暴露到全局
if (process.env.NODE_ENV === 'development') {
  window.channelDebug = channelDebug
  console.log('渠道调试工具已加载，使用 window.channelDebug 访问')
} 